function VS=PrepareStim(VS)
BaseRect=[0,0,120,120];
StimBias=500;
for iStim=1:length(VS.StimConditionIndice)
    VS.StimPos(iStim,:)=CenterRectOnPointd(BaseRect,VS.WindowInfo.xCenter+(-mod(iStim,2)+0.5)*StimBias,...
        VS.WindowInfo.screenYpixels*2/length(VS.StimConditionIndice)*ceil(iStim/2)-VS.WindowInfo.screenYpixels*2/length(VS.StimConditionIndice)*0.5);
end


for iFrame=1:round(VS.FlickPhaseDur/VS.WindowInfo.ifi)
    VS.WindowBuff(iFrame)= Screen(VS.WindowInfo.window, 'OpenOffScreenWindow', VS.WindowInfo.black, VS.WindowInfo.windowRect, 8, 1);
    for iStim=1:length(VS.StimConditionIndice)
        color=VS.FlickCode(iStim,iFrame);
        Screen('FillRect', VS.WindowBuff(iFrame), [color,color,color], VS.StimPos(iStim,:));    
        
    end
end
        